<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>运行回调函数</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="yaf-application.environ.html">Yaf_Application::environ</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="yaf-application.getappdirectory.html">Yaf_Application::getAppDirectory</a></div>
 <div class="up"><a href="class.yaf-application.html">Yaf_Application</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="yaf-application.execute" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Yaf_Application::execute</h1>
  <p class="verinfo">(Yaf &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Application::execute</span> &mdash; <span class="dc-title">运行回调函数</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yaf-application.execute-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>Yaf_Application::execute</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$entry</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$...</code></span>
   )</div>

  <p class="para rdfs-comment">
   这个方法通常用于在cron任务中运行Yaf_Application。
   在cron任务中也可以使用autoloader和Bootstrap机制。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-yaf-application.execute-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">entry</code></em></dt>

    <dd>

     <p class="para">  
       一个有效的回调函数
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">...</code></em></dt>

    <dd>

     <p class="para">
      零个或者多个要传递给函数的参数。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-yaf-application.execute-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-yaf-application.execute-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-4024">
   <p><strong>Example #1 <span class="function"><strong>Yaf_Application::execute()</strong></span>example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">main</span><span style="color: #007700">(</span><span style="color: #0000BB">$argc</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$argv</span><span style="color: #007700">)&nbsp;{<br />}<br /><br /></span><span style="color: #0000BB">$config&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"application"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"directory"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">))&nbsp;.&nbsp;</span><span style="color: #DD0000">"/application"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;),<br />);<br /><br /></span><span style="color: #FF8000">/**&nbsp;Yaf_Application&nbsp;*/<br /></span><span style="color: #0000BB">$application&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Yaf_Application</span><span style="color: #007700">(</span><span style="color: #0000BB">$config</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$application</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">(</span><span style="color: #DD0000">"main"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$argc</span><span style="color: #007700">,&nbsp;&nbsp;</span><span style="color: #0000BB">$argv</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>以上例程的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
</pre></div>
   </div>
  </div>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="yaf-application.environ.html">Yaf_Application::environ</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="yaf-application.getappdirectory.html">Yaf_Application::getAppDirectory</a></div>
 <div class="up"><a href="class.yaf-application.html">Yaf_Application</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
